package com.ruoyi.omp.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.omp.api.RemoteFineService;
import com.ruoyi.omp.api.domain.FeFine;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author: cjie
 * @description: 违约金信息降级处理
 * @date: 2021/11/9
 */
@Component
public class RemoteFineFactory implements FallbackFactory<RemoteFineService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteFineFactory.class);

    @Override
    public RemoteFineService create(Throwable throwable) {
        return new RemoteFineService() {
            @Override
            public R<FeFine> listLastFine(String billId) {
                return R.fail("查询违约金信息失败:" + throwable.getMessage());
            }

            @Override
            public R addFine(FeFine feFine) {
                return R.fail("新增违约金信息失败:" + throwable.getMessage());
            }

            @Override
            public R updateFine(FeFine feFine) {
                return R.fail("修改违约金信息失败:" + throwable.getMessage());
            }
        };
    }
}
